<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        .red {
            color: red;
        }

        .yellow {
            color: yellow;
        }
    </style>
</head>
<body>
<div id="app">
<com css="red" user="tom"></com>
<com css="yellow" user="tom"></com>
</div>
<!--组件独有props属性 作用:用来给组件传递相应的静态或动态数据-->
<script>
    let com = {
        template: `
        <div > 这是我的组件
        <div :class="css">111111</div></div>
        `,
        props:["css","user"],
        created(){
            console.log(this.user)
        }
    }
    new Vue({
        el: "#app",
        data: {},
        components:{
            "com":com,
        }
    })
</script>

</body>
</html>